answer "Want to give the file name (or pathname) ?" with "Yes" or "No"
if it is "Yes"
then
get newFileName("Create PICT file :","MyPICTFile")
if it is empty then exit mouseUp
ClipToPICTFile it
else ClipToPICTFile
put the Result into cd fld 2
end mouseUp
-- part 27 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=309 top=298 right=320 bottom=479
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: PICTFileToClip
----- HyperTalk script -----
on mouseUp
put FilePath("PICT","PICT file to import :") into File
if File ≠ empty
then
answer "<scale> parameter :" with "False" or "True"
put it into Scale
ask "<DestRect> parameter :" with "0,0,512,342"
if it is empty
then PICTFileToClip File,Scale
else PICTFileToClip File,Scale,it
get the Result
if it is empty
then
set cursor to 4
go next
type "V" with commandKey
put "Please click..."
wait until the mouseClick
put empty
type "X" with commandKey
choose browse tool
go previous
else put it into cd fld 2
end if
end mouseUp
-- part 28 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=75 top=268 right=285 bottom=480
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name:
-- part contents for card part 1
----- text -----
This stack contains two XCMDs, PictFileToClip and ClipToPictFile, that allow to transfer a picture between the Clipboad and a PICT file.
PICTFileToClip 1.7
DESCRIPTION
------------
Transfers the PICT file content to the clipboard.
SYNTAX
-------
PICTFileToClip <pathname of PICT file>[,<Scale>][,<origin>][,<NewRect>]
PARAMETERS
------------
The file pathname is the only needed parameter, and is a string giving the full pathname of the PICT file on the volume. It can be a single name or whole pathname. If just a single name is supplied, the file is assumed to be in the same folder than the current stack.
Scale is boolean, and tells the picture to be scaled (TRUE) or cropped
(FALSE) to fit in the destination rectangle. Default value is FALSE, and the only visible picture's part will be the top left rectangle of it.
Origin is a point "X,Y" giving the origin of the picture to get.
NewRect tells the destination rectangle that will be used for pasting. Its coordinates are relative to the card, and it will be "Xt,Yt,Xb,Yb" shaped. Default value is the whole card's rectangle.
Using "!", "?" or "=" as first parameter will return an online help (resp. copyright, syntax and output).
USING
------
If no error occured, the Result will be empty. Otherwise, it will contain :
"Error : Not a file"
"Error : Not a folder"
"Error : Alias file not supported"
"Error : Volume not found"
"Error : Bad Name"
"Error : File not found"
"Error : Folder not found"
"Error : File is busy"
"Error : I/O Error"
"Error : Folder is full"
"Error : Volume is locked"
"Error : No resource fork"
"Error : Duplicate file/folder name"
"Error : Moving whole volume not allowed"
"Error : Not an AppleShare volume"
"Error : AppleShare insufficient privileges"
"Error : Missing or empty parameter"
"Error : Defined Rect is off-screen"
"Error : Bad param #X"
"Error : Not a PICT file"
"Error : Out of memory"
"Error : Couln't clear Clipboard"
"Error : Couln't set Clipboard"
HISTORY
--------
1.7 : 12/25/91
• Fixed alias file bug under System 7.0.1
1.6 : 11/15/91
• Fixed a random bug due to image size
1.5 : 09/02/91
• Fixed a bug crashing Macs without Color QD
1.4 : 08/20/91
• Added support for color pictures in HC 2.0.
• Removed GetFrontDocWindow, StrToRect and StrToPoint calls for HC 1.2 compatibility.
1.3 : 08/04/91
• Added support for System 7.0 alias files
• General enhancement of the code
• Added "=" param for online help
1.1
• Adds online help
• add origin parameter
ClipToPICTFile 1.7
By F. Rinaldi
DESCRIPTION
------------
Each call to ClipToPICTFile XCMD creates a PICT file with the current clipboard's content.
SYNTAX
------
ClipToPICTFile[<name or pathname of PICT file>][,"c=<creator>"]
PARAMETERS
-------------
With no parameter, the default created file is named "PICTFile X" at the current stack's level, X being a positive integer which increments automatically. With a single name, the file will be created at the current stack's level. With a full pathname, its location can be choosen exactly on the volume.
If no Creator is given, "MDPL" will be used as default (for MacDraw).
Using "!", "?" or "=" as first parameter will return an online help (resp. copyright, syntax and output).
USING
-----
If no error occured, the Result will be empty, or will contain the full patname of the created file if no pathname was passed. Otherwise, it can contain :
This (these) external(s) is (are) FreeWare,allowing unlimited use in any non-commercial stack. You just need in this case to mention the author's name and copyright in your stack.
Any commercial use must be licensed and aknowledged by the author.